from .yuntongxun.sms import CCP

from . import constants
from celery_tasks.main import app
import logging
logger = logging.getLogger('django')

@app.task(name='send_sms_code')
def send_sms_code(mobile,sms_code):

    print(mobile,sms_code)


    ccp = CCP()
    try:
        sms_expires = constants.SMS_CODE_REDIS_EXPIRES // 60
    except Exception as e:
        logger.error('发送验证码短信[异常][mobile:%s,message:%s]'%(mobile,e))
    ccp.send_template_sms(mobile,[sms_code,sms_expires],1)